#include <stdio.h>
#include <time.h>
#include <sys/time.h>
int main(void)
{
  int i=0;
  struct timeval tv;

  gettimeofday(&tv, NULL);
  printf("sec:ms=%d:%d\n",  (int)tv.tv_sec, (int)tv.tv_usec/1000);

  struct tm *ptm = localtime(&tv.tv_sec);
  char ctmnow[128] =    { 0 };
  sprintf(ctmnow, "%4d-%02d-%02d %02d:%02d:%02d", 1900 + (int)ptm->tm_year,\
	1+ptm->tm_mon,ptm->tm_mday,ptm->tm_hour,ptm->tm_min,ptm->tm_sec);
  printf("date  %s\n",ctmnow);
  strftime(ctmnow,sizeof(ctmnow),"auto date %Y-%m-%d %H:%M:%S",ptm); 
//strftime(ctmnow,sizeof(ctmnow),"auto date %F %T",ptm); 
  printf("%s\n",ctmnow);



  return 0;
}
